package com.ruoyi.bizsys.controller;

import java.util.List;

import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.bizsys.domain.BatchJobMonitoring;
import com.ruoyi.bizsys.service.IBatchJobMonitoringService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 跑批日切管理Controller
 *
 * @author african-loan
 * @date 2021-12-30
 */
@RestController
@RequestMapping("/business/BatchJobMonitoring")
public class BatchJobMonitoringController extends BaseController {
    @Autowired
    private IBatchJobMonitoringService batchJobMonitoringService;

/**
 * 查询跑批日切管理列表
 */
@PreAuthorize("@ss.hasPermi('business:BatchJobMonitoring:list')")
@GetMapping("/list")
        public TableDataInfo list(BatchJobMonitoring batchJobMonitoring) {
        startPage();
        List<BatchJobMonitoring> list = batchJobMonitoringService.selectBatchJobMonitoringList(batchJobMonitoring);
        return getDataTable(list);
    }
    
    /**
     * 导出跑批日切管理列表
     */
    @PreAuthorize("@ss.hasPermi('business:BatchJobMonitoring:export')")
    @Log(title = "跑批日切管理", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(BatchJobMonitoring batchJobMonitoring) {
        List<BatchJobMonitoring> list = batchJobMonitoringService.selectBatchJobMonitoringList(batchJobMonitoring);
        ExcelUtil<BatchJobMonitoring> util = new ExcelUtil<BatchJobMonitoring>(BatchJobMonitoring.class);
        return util.exportExcel(list, "BatchJobMonitoring");
    }

    /**
     * 获取跑批日切管理详细信息
     */
    @PreAuthorize("@ss.hasPermi('business:BatchJobMonitoring:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id) {
        return AjaxResult.success(batchJobMonitoringService.selectBatchJobMonitoringById(id));
    }

    /**
     * 新增跑批日切管理
     */
    @PreAuthorize("@ss.hasPermi('business:BatchJobMonitoring:add')")
    @Log(title = "跑批日切管理", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody BatchJobMonitoring batchJobMonitoring) {
        return toAjax(batchJobMonitoringService.insertBatchJobMonitoring(batchJobMonitoring));
    }

    /**
     * 修改跑批日切管理
     */
    @PreAuthorize("@ss.hasPermi('business:BatchJobMonitoring:edit')")
    @Log(title = "跑批日切管理", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody BatchJobMonitoring batchJobMonitoring) {
        return toAjax(batchJobMonitoringService.updateBatchJobMonitoring(batchJobMonitoring));
    }

    /**
     * 删除跑批日切管理
     */
    @PreAuthorize("@ss.hasPermi('business:BatchJobMonitoring:remove')")
    @Log(title = "跑批日切管理", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids) {
        return toAjax(batchJobMonitoringService.deleteBatchJobMonitoringByIds(ids));
    }
}
